﻿using System;
using System.Collections.Generic;
using System.Text;
using NLBS.Entity;
using NLBS.Framework;
using NLBS.Data;

namespace NLBS.Views.Admin
{
    public class SettingPresenter : Presenter<ICommentListView, IAction<Setting>>
    {
        public override void OnActionLoaded()
        {
            this.Action.DataSelectSingle += new EventHandler(Action_DataSelectSingle);
            this.Action.DataUpdate += new EventHandler(Action_DataUpdate);
            base.OnActionLoaded();
        }

        void Action_DataUpdate(object sender, EventArgs e)
        {
            DbProvider.Instance().UpdateSettings(this.Action.Entity);
        }

        void Action_DataSelectSingle(object sender, EventArgs e)
        {
            this.Action.Entity = BlogInfo.Instance().GetSetting(this.Action.Entity.Name);
        }
    }
}
